<?php

namespace Database\Seeders;

use App\Kuafu\User\Model\UserRoleMapping;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class UserRoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $insertArr = [
            ['userId' => '1', 'roleId' => 1, 'brandId' => 1, 'shopId' => 0, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 2, 'brandId' => 2, 'shopId' => 0, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 3, 'brandId' => 3, 'shopId' => 0, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 4, 'brandId' => 1, 'shopId' => 1, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 5, 'brandId' => 1, 'shopId' => 2, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 5, 'brandId' => 1, 'shopId' => 3, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 5, 'brandId' => 2, 'shopId' => 4, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
            ['userId' => '1', 'roleId' => 5, 'brandId' => 3, 'shopId' => 5, 'isDeleted' => 0, 'createdAt' => time(), 'updatedAt' => time()],
        ];

        $table = UserRoleMapping::query()->getModel()->getTable();
        DB::table($table)->truncate();
        DB::table($table)->insert($insertArr);
    }
}
